import React from 'react'
import preClassName from '../../../utils/preClassName'
import VisibilitySensor from 'react-visibility-sensor';
import {ScrollViewProps} from './interface'
import './style.sass'

const ScrollView: React.FC<ScrollViewProps> = ({children}) => {
  return (
    <div className={preClassName('scroll')}>
      <div className={preClassName('scroll-inner')}>
        {children}
        <VisibilitySensor onChange={(isVisible: boolean) => {
          console.log('加载中...', isVisible)
        }}>
          <div>加载中...</div>
        </VisibilitySensor>
      </div>
    </div>
  )
}

export default ScrollView;
